using System;
using System.Collections.Generic;
using System.Text;
using System.IO;

namespace AutoBurnerLibrary
{

    public class BurnItem
    {
        private string pathToItem = "";
        private string FileName = "";
        private long _fileSize = 0;
        private string _filePathAndName = "";

        public long FileSize
        {
            get { return _fileSize; }
        }

        private BurnItem()
        {

        }

        public static BurnItem CreateBurnItem(FileInfo file)
        {
            BurnItem burnItem = new BurnItem();

            burnItem.pathToItem = Path.GetDirectoryName(file.FullName);
            burnItem.FileName = Path.GetFileName(file.FullName);
            burnItem._fileSize = file.Length;
            burnItem._filePathAndName = file.FullName;

            return burnItem;
        }

        /// <summary>
        /// The difference between this method and the CreateBurnItem factory method is that this one does not actually
        /// go out to the file structure and create a FileInfo object based on a real file object. This was necessary
        /// to allow for list manipulation in the absence of actual files being present. Most notably, I wasn't able to create a 
        /// burnItem based on listening to a file delete event. Unfortunately I couldn't hook into a pre delete event.
        /// </summary>
        /// <param name="filePath">Full Path name</param>
        /// <returns>BurnItem</returns>
        public static BurnItem CreateShellBurnItem(string filePath)
        {
            BurnItem burnItem = new BurnItem();
            burnItem.pathToItem = Path.GetDirectoryName(filePath);
            burnItem.FileName = Path.GetFileName(filePath);
            burnItem._filePathAndName = filePath;

            return burnItem;
        }

        public override bool Equals(object obj)
        {

            if (!(obj is BurnItem)) return false;

            return this._filePathAndName == ((BurnItem)obj)._filePathAndName;

        }
    }
}
